<template>
  <div class="tottom">
    <div class="centerkan">
      <span>人气推荐></span>
    </div>
    <div class="box">
      <div
        v-for="(item, index) in list"
        :key="index"
        v-show="index < 4"
        @click="goshopcar(item)"
      >
        <img :src="item.pic" alt="" />
        <p class="p1" v-html="item.name">{{}}</p>
        <p class="p2">{{ item.characteristic }}</p>
        <span class="sp1">￥{{ item.minPrice }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    this.$API.getStoreList().then((res) => {
      this.list = res.data.data;
      this.list = this.list.slice(9, 13);
      // console.log(res);
    });
  },
  methods: {
    goshopcar(item) {
      this.$router.push({ path: "/shopcar", query: { id: item.id } });
    },
  },
};
</script>

<style lang="scss" scoped>
.centerkan {
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  span {
    font-size: 1rem;
  }
}
.box {
  width: 100%;
  //   height: 4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  font-size: 0.7rem;
  div {
    width: 47%;
    // height: 5rem;
    // background: seagreen;

    img {
      width: 100%;
      height: 60%;
    }
    .sp1 {
      color: red;
    }
  }
  .tottom {
    position: fixed;
    bottom: 10%;
  }
}
.p1 {
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p2 {
  font-size: 0.4rem;
  color: grey;
}
</style>